<template>
  <div class="playpage_account-wrapper">
    <!-- 头像 -->
    <mivaAvatar :avatar="avatar" class="playpage-avatar__module" v-bind="userInfo" />
    <!-- 弹出界面 -->
    <div class="item-profile-m miva-fadeInUp">
      <!-- 用户昵称组件 -->
      <nicknameModule :userInfo="userInfo" class="i-nickname" />
      <!-- 帐号绑定信息 -->
      <bindModule :userInfo="userInfo" />
      <!-- 等级与经验条  -->
      <div class="grade">
        <el-progress :format="format" :percentage="0" :stroke-width="3" />
      </div>
      <!-- 操作菜单 -->
      <menuModule />
      <div class="item-member-bottom">
        <span @click="logoutAction" class="item-logout">
          <i class="logout-icon iconfont icon-ziyuanldpi1" />退出
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
import nicknameModule from '@/components/nickname.vue';
import menuModule from './menu.vue';
import bindModule from './bind.vue';

export default {
    name: 'NavUserCenterSigninModule',
    components: {
        nicknameModule,
        menuModule,
        bindModule,
    },
    computed: {
        ...mapGetters(['userInfo', 'avatar']),
    },
    methods: {
        ...mapActions('account', ['logoutAction']),
        format() {
            return '0/100';
        },
    },
};
</script>

<style lang="less">
@btnLogoutHeight: 30px;

.playpage_account-wrapper {
  display: inline-block;
  position: relative;
  z-index: 10;
  user-select: none;
  &:hover {
    .playpage-avatar__module {
      transform: scale(1.1, 1.1) translateY(30%);
    }
    .item-profile-m {
      display: block;
    }
  }
  .playpage-avatar__module {
    position: relative;
    top: -3px;
    z-index: 1;
    transition: all 0.2s cubic-bezier(0.1, 0.5, 0.8, 1);
    transform: scale(0.7, 0.7) translateY(0%);
  }
  .i-nickname {
    padding-bottom: 8px;
    justify-content: center;
  }
  .item-profile-m {
    width: 260px;
    line-height: normal;
    margin-left: -130px;
    padding: 50px 20px 10px + @btnLogoutHeight;
    box-sizing: border-box;
    position: absolute;
    left: 50%;
    top: 42px;
    z-index: 0;
    display: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16);
    background: #fff;
  }
  .item-member-menu {
    margin: auto;
    border-top: 1px solid #e5e9ef;
    padding: 10px 20px 40px;
  }
  .item-member-bottom {
    width: 100%;
    height: @btnLogoutHeight;
    line-height: @btnLogoutHeight;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: #f4f5f7;
    border-radius: 0 0 4px 4px;
  }
  .item-logout {
    float: right;
    padding-right: 20px;
    color: #222;
    display: flex;
    align-items: center;
    cursor: pointer;
    .logout-icon {
      color: @global_text_color_grey;
      margin-right: 5px;
      font-size: 12px;
    }
  }
  .grade {
    padding: 10px 0 15px;
    white-space: nowrap;
  }
}
</style>
